home *** CD-ROM | disk | FTP | other *** search
- O.K, this is even less than a README, it's just a generated list of the
- browser-function, but I do not have very much time at the moment.
-
- I hope you can follow my comments in order to use the browser-functions.
- Please look also into the source-files of the sample clients.
-
-
- /*********************************************************
- Short overview:
-
- A Client has first to connect to a server to which it
- can send information requests and get the results.
-
- Normally, the functions defined in this module do
- automatically connect to the master-server, which is
- the first (or only) server started. However, a client
- can connect to an other server if it knows it's server-ID.
-
- This ID can be obtained by the get_server_id function
- which asks the master server for the ID of the server
- which processes a special browser file.
-
- Each client can only be connected to one server at a given
- time. However, you can switch to an other server by first
- disconnect the old one and then connect to the new
- server.
-
- All functions send the request to the server when they are
- called for the first time. If they can return more than
- one return-value, the have to be called multiple times.
- After the last value has been returned, these functions
- return RET_END instead of 0.
-
- For the documentation of the functions, please look in the
- comments preceeding these functions.
-
- ****************************************/
-
-
- List of all browser-function:
-
- brs_get_all_funct all functions in a project
- brs_get_all_global_vars all global variables in a project
- brs_get_funct_calls all function calls in a function
- brs_get_var_uses all variables used in a function
- brs_get_funct_called_by all functions calling a function
- brs_get_var_used_by all functions using a variable
- brs_get_includes all include files of a source-file
- brs_get_funct_pos definition position of a function
- brs_get_var_pos definition position of a global variable
- brs_get_all_types all typedef's, struct's and union's
- brs_get_component_use usage of a struct or union component
- brs_reinit_browser reinit the server with new browser-file
- brs_get_server_id get ID of server processing given .brc-file
- brs_disconnect_server disconnect the current server
- brs_connect_server connect to server with given ID
- brs_get_all_files all files in the project
- brs_get_file_dir working directory of a source-file
- brs_get_all_macro all macro-definitions in project
- brs_what_is type and definition-pos of an identifier
- brs_get_macro_pos position of a macro definition
- brs_cut cut definition lines from source-files
- brs_get_item_pos position of an ident with unknown type
-
- ================================================================================
- Function : brs_connect_server
- File : clients.c Line 76
- Length : 32 Lines
- Declaration:
- short brs_connect_server(int server_id)
- --------------------------------------------------------------------------------
- /* connects to server;
-
- return: 0 ... O.K.
- else ... Return-value from server
- */
-
-
- ================================================================================
- Function : brs_disconnect_server
- File : clients.c Line 114
- Length : 11 Lines
- Declaration:
- void brs_disconnect_server(void)
- --------------------------------------------------------------------------------
- /* disconnects actual server
-
- A client may only be connected to one server at a time
-
- */
-
-
- ================================================================================
- Function : brs_get_all_files
- File : clients.c Line 1198
- Length : 55 Lines
- Declaration:
- short brs_get_all_files( char *file, char *module)
- --------------------------------------------------------------------------------
- /* This function returns all files in a project (just main-files, not the
- includes)
- strings should be have a size of at least STRINGSIZE Bytes
-
- The first time, this function is called, it issues the
- CMD_FILES-command to the server.
-
- Return-values:
-
- file ... filename
- module ... module, where file belongs to
-
- return: 0 ... O.K., function-info is stored in arguments
- RET_END ... No more functions found
- else ... error returned by get_brs_ret
- error-message in funct/file
- */
-
-
- ================================================================================
- Function : brs_get_all_funct
- File : clients.c Line 194
- Length : 60 Lines
- Declaration:
- short brs_get_all_funct( char *funct, char *file, long *line, char *module, short *static_flag)
- --------------------------------------------------------------------------------
- /* This function returns all functions defined in the project.
- strings should be have a size of at least STRINGSIZE Bytes
-
- funct ... holds the name of the function,
- file ... the file, where the function is defined (or "" if unknown)
- line ... the line in the file, where function is defined (if known)
- linenumber is the first line after the ')' of the arguments
- module ... module to which this file belongs to (or "" if not known)
- static_flag ... 1 if function is static, 0 else
-
- The first time, this function is called, it issues the
- CMD_FUNCTIONS-command to the server.
- This function should be called with a NULL-pointer in funct
- to reset internal flags if you want to get all functions a
- second time. However, it does a self-reset, it the RET_END-value
- is returned by the server.
-
- return: 0 ... O.K., function-info is stored in arguments
- RET_END ... No more functions found
- else ... error returned by get_brs_ret
- error-message in funct/file
- */
-
-
- ================================================================================
- Function : brs_get_all_global_vars
- File : clients.c Line 261
- Length : 60 Lines
- Declaration:
- short brs_get_all_global_vars( char *funct, char *file, long *line, char *module, short *static_flag)
- --------------------------------------------------------------------------------
- /* This function returns all local variables defined in project.
-
- it works like "get_all_funct" !
- */
-
- Functions called from files:
- clients.c intrface.c
-
- ================================================================================
- Function : brs_get_all_macro
- File : clients.c Line 1327
- Length : 60 Lines
- Declaration:
- short brs_get_all_macro( char *macro, char *file, long *line )
- --------------------------------------------------------------------------------
- /* This function returns all macros defined in the project.
- strings should be have a size of at least STRINGSIZE Bytes
-
- macro ... holds the name of the macro
- file ... the file, where the macro is defined (or "" if unknown)
- line ... the line in the file, where macro is defined (if known)
-
-
- return: 0 ... O.K., function-info is stored in arguments
- RET_END ... No more functions found
- else ... error returned by get_brs_ret
- error-message in macro/file
- */
-
-
- ================================================================================
- Function : brs_get_all_types
- File : clients.c Line 1013
- Length : 67 Lines
- Declaration:
- short brs_get_all_types( short type_code, char *type_name, char *file, long *line)
- --------------------------------------------------------------------------------
- /* This function returns all types (structs, unions, typedefs, enums)
- defined in the project.
- strings should be have a size of at least STRINGSIZE Bytes
-
- INPUT:
- type_code ... 0 ... structs
- 1 ... unions
- 2 ... enums
- 3 ... typedefs
-
- OUTPUT:
- type_name ... holds the name of the type,
- file ... the file, where the type is defined (or "" if unknown)
- line ... the line in the file, where type is defined (if known)
- linenumber is the first line after the ')' of the arguments
-
-
- return: 0 ... O.K., function-info is stored in arguments
- RET_END ... No more functions found
- else ... error returned by get_brs_ret
- error-message in funct/file
- */
-
-
- ================================================================================
- Function : brs_get_any_message
- File : intrface.c Line 456
- Length : 17 Lines
- Declaration:
- short brs_get_any_message(int *type, short *cmd, short *flag, int *pid, long *id, char *buf)
- --------------------------------------------------------------------------------
- /* Debug-function: returns any message from message-queue
- */
-
-
- ================================================================================
- Function : brs_get_component_use
- File : clients.c Line 1107
- Length : 71 Lines
- Declaration:
- short brs_get_component_use( int type, char *comp_name, char *f_in,
- char *file, long *line, char *function)
- --------------------------------------------------------------------------------
- /* This function returns the usage of components.
-
- INPUT:
- type 0 Get all components in a file (or global if arg2 == "")
- 1 Get all component references in a function
- 2 Get all components in same line like variable
-
- component_name ... name of the target component of a struct/union
-
- arg2 depends on type: 0 ... filename or ""
- 1 ... function name
- 2 ... variable name
-
- OUTPUT:
- file ... the file, where component used
- line ... the line in the file, where component used
- function ... ident of function where component used
-
- return: 0 ... O.K.
- RET_END ... No more items found
- else ... error returned by get_brs_ret
- error-message in file/function
- */
-
-
- ================================================================================
- Function : brs_get_file_dir
- File : clients.c Line 1274
- Length : 37 Lines
- Declaration:
- short brs_get_file_dir( char *file_in, char *dir)
- --------------------------------------------------------------------------------
- /* This function returns the working directory of a given
- source-file
-
- INPUT:
- file_in ... source-file
-
- OUTPUT
- (if ret-value is 0:)
- dir ... working-directory
-
- (if ret-value if RET_ERROR)
- dir ... Error message 1
-
-
- return: 0 ... O.K., working-directory stored
- else ... error returned by get_brs_ret
- */
-
-
- ================================================================================
- Function : brs_get_funct_called_by
- File : clients.c Line 542
- Length : 62 Lines
- Declaration:
- short brs_get_funct_called_by( char *funct_in, char *file_in, short sym_once,
- char *funct, char *file, long *line,
- char *module, short *static_flag)
- --------------------------------------------------------------------------------
- /* This function returns every function, that calls the specific
- function
- strings should be have a size of at least STRINGSIZE Bytes
-
- INPUT:
- funct_in ... target-function, (just interesting for the first time)
- file_in ... file, where target-function is defined (or called: in this
- case the one with the right scope (global/static) will be
- taken).
- may be "", if function is just defined once
- sym_once ... if set to 1, every function is just returned once,
- otherwise every single call will be returned.
-
- OUTPUT
- (if ret-value is 0:)
- funct ... holds the name of the function,
- file ... the file, where the target-function is called
- line ... linenumber, where target-function is called
- module ... always ""
- static_flag ... 1 if function is static, 0 else
-
- (if ret-value if RET_ERROR)
- funct ... Error message 1
- file ... Error message 2 (might be "")
-
-
- The first time, this function is called, it issues the
- CMD_...-command to the server.
- This function should be called with a NULL-pointer in funct
- to reset internal flags if you want to get all functions a
- second time. However, it does a self-reset, it the RET_END-value
- is returned by the server.
-
- return: 0 ... O.K., function-info is stored in arguments
- RET_END ... No more functions found
- else ... error returned by get_brs_ret
- */
-
-
- ================================================================================
- Function : brs_get_funct_calls
- File : clients.c Line 364
- Length : 62 Lines
- Declaration:
- short brs_get_funct_calls( char *funct_in, char *file_in, short sym_once,
- char *funct, char *file, long *line,
- char *module, short *static_flag)
- --------------------------------------------------------------------------------
- /* This function returns all functions called by a specific
- function
- strings should be have a size of at least STRINGSIZE Bytes
-
- INPUT:
- funct_in ... target-function, (just interesting for the first time)
- file_in ... file, where target-function is defined (or called: in this
- case the one with the right scope (global/static) will be
- taken)
- may be "", if function is just defined once
- sym_once ... if set to 1, every function is just returned once,
- otherwise every single call will be returned.
-
- OUTPUT
- (if ret-value is 0:)
- funct ... holds the name of the function,
- file ... the file, where the function is called
- line ... linenumber, where function is called
- module ... always ""
- static_flag ... 1 if function is static, 0 else
-
- (if ret-value if RET_ERROR)
- funct ... Error message 1
- file ... Error message 2 (might be "")
-
-
- The first time, this function is called, it issues the
- CMD_FUNCTIONS-command to the server.
- This function should be called with a NULL-pointer in funct
- to reset internal flags if you want to get all functions a
- second time. However, it does a self-reset, it the RET_END-value
- is returned by the server.
-
- return: 0 ... O.K., function-info is stored in arguments
- RET_END ... No more functions found
- else ... error returned by get_brs_ret
- */
-
-
- ================================================================================
- Function : brs_get_funct_pos
- File : clients.c Line 832
- Length : 43 Lines
- Declaration:
- short brs_get_funct_pos( char *funct_in, char *file_in,
- char *file, long *line, long *end_line, char *module)
- --------------------------------------------------------------------------------
- /* This function returns the position, where a given function
- is defined
-
- INPUT:
- funct_in ... target-function
- file_in ... file, where target-function is defined (and defined only !)
- may be "", if function is just defined once
-
- OUTPUT
- (if ret-value is 0:)
- file ... the file, where the function is defined
- line ... linenumber, where function is defined
- end_line ... linenumber, where function ends
- module ... module where file belongs to or ""
-
- (if ret-value if RET_ERROR)
- file ... Error message 1
- module ... Error message 2 (might be "")
-
-
- return: 0 ... O.K., function-info is stored in arguments
- else ... error returned by get_brs_ret
- */
-
-
- ================================================================================
- Function : brs_get_includes
- File : clients.c Line 746
- Length : 59 Lines
- Declaration:
- short brs_get_includes( char *file_in,
- char *file, char *inc_file, short *sys_flag)
- --------------------------------------------------------------------------------
- /* This function returns all include-files of a given file.
-
- Every Include is named just once
-
- INPUT:
- file_in ... filename of main-file ( xxx.c ), where the browser
- should look for includes
-
- OUTPUT
- (if ret-value is 0:)
- file ... include-filename
- inc_file ... file, where #include-directive was found
- (may be mainfile or an other headerfile in
- case of nested include-levels)
- sys_flag ... 1 if include-file is a system-header
-
- (if ret-value if RET_ERROR)
- file ... Error message 1
- inc_file ... Error message 2
-
-
- The first time, this function is called, it issues the
- CMD_FUNCTIONS-command to the server.
- This function should be called with a NULL-pointer in funct
- to reset internal flags if you want to get all functions a
- second time. However, it does a self-reset, it the RET_END-value
- is returned by the server.
-
-
- return: 0 ... O.K., function-info is stored in arguments
- RET_END ... No more functions found
- else ... error returned by get_brs_ret
- */
-
-
- ================================================================================
- Function : brs_get_macro_pos
- File : clients.c Line 1536
- Length : 41 Lines
- Declaration:
- short brs_get_macro_pos( char *macro, char *file_in,
- char *file, long *line, char *module)
- --------------------------------------------------------------------------------
- /* This function returns the position where given macro
- is defined
-
- INPUT:
- macro ... target-macro
- file_in ... file, where target-macro is defined
- may be "", if macro is just defined once
-
- OUTPUT
- (if ret-value is 0:)
- file ... the file, where the macro is defined
- line ... linenumber, where macro is defined
- module ... module where file belongs to or ""
-
- (if ret-value if RET_ERROR)
- file ... Error message 1
- module ... Error message 2 (might be "")
-
- return: 0 ... O.K., variable-info is stored in arguments
- else ... error returned by get_brs_ret
- */
-
-
- ================================================================================
- Function : brs_get_msg_debug
- File : intrface.c Line 1599
- Length : 177 Lines
- Declaration:
- short brs_get_msg_debug(short command, int * server, int *pid, short *ret_cmd, int *ret_id,
- short *r_flag, char *arg1,
- char *arg2, char *arg3, char *arg4)
- --------------------------------------------------------------------------------
- /* get messages in queue
- */
-
-
- ================================================================================
- Function : brs_get_server_id
- File : clients.c Line 133
- Length : 16 Lines
- Declaration:
- int brs_get_server_id(char *browser_file)
- --------------------------------------------------------------------------------
- /* sends a browser filename to the master and returns
- the ID of the server processing this file
-
- return-value -1 or -2 : Error
- */
-
-
- ================================================================================
- Function : brs_get_var_pos
- File : clients.c Line 901
- Length : 41 Lines
- Declaration:
- short brs_get_var_pos( char *var_in, char *file_in,
- char *file, long *line, char *module)
- --------------------------------------------------------------------------------
- /* This function returns the position where given global variable
- is defined
-
- INPUT:
- var_in ... target-variable
- file_in ... file, where target-variable is defined (defined only !)
- may be "", if variable is just defined once
-
- OUTPUT
- (if ret-value is 0:)
- file ... the file, where the variable is defined
- line ... linenumber, where variable is defined
- module ... module where file belongs to or ""
-
- (if ret-value if RET_ERROR)
- file ... Error message 1
- module ... Error message 2 (might be "")
-
-
- return: 0 ... O.K., variable-info is stored in arguments
- else ... error returned by get_brs_ret
- */
-
-
- ================================================================================
- Function : brs_get_var_used_by
- File : clients.c Line 646
- Length : 62 Lines
- Declaration:
- short brs_get_var_used_by( char *var_in, char *file_in, short sym_once,
- char *funct, char *file, long *line,
- char *module, short *static_flag)
- --------------------------------------------------------------------------------
- /* This function returns every function, that uses the specific
- variable
- strings should be have a size of at least STRINGSIZE Bytes
-
- INPUT:
- var_in ... target-variable, (just interesting for the first time)
- file_in ... file, where target-variable is defined (or used: in this
- case the one with the right scope (global/static) will be
- taken).
- may be "", if variable is just defined once
- sym_once ... if set to 1, every function is just returned once,
- otherwise every single usage will be returned.
-
- OUTPUT
- (if ret-value is 0:)
- funct ... holds the name of the function,
- file ... the file, where the target-variable is used
- line ... linenumber, where target-variable is used
- module ... always ""
- static_flag ... 1 if function is static, 0 else
-
- (if ret-value if RET_ERROR)
- funct ... Error message 1
- file ... Error message 2 (might be "")
-
-
- The first time, this function is called, it issues the
- CMD_...-command to the server.
- This function should be called with a NULL-pointer in funct
- to reset internal flags if you want to get all functions a
- second time. However, it does a self-reset, it the RET_END-value
- is returned by the server.
-
- return: 0 ... O.K., function-info is stored in arguments
- RET_END ... No more functions found
- else ... error returned by get_brs_ret
- */
-
-
- ================================================================================
- Function : brs_get_var_uses
- File : clients.c Line 437
- Length : 62 Lines
- Declaration:
- short brs_get_var_uses( char *funct_in, char *file_in, short sym_once,
- char *var, char *file, long *line,
- char *module, short *static_flag)
- --------------------------------------------------------------------------------
- /* This function gets all global variables that are used
- by the given function.
-
- It works like "get_funct_calls", so see above
- for dokumentation.
- */
-
-
- ================================================================================
- Function : brs_kill_server
- File : clients.c Line 158
- Length : 9 Lines
- Declaration:
- short brs_kill_server(void)
- --------------------------------------------------------------------------------
- /* This function kills server. Return-values like connect_server
- return: 0 ... O.K.
- else ... Return-value from server
- */
-
- Functions called from files:
- clients.c intrface.c
-
- ================================================================================
- Function : brs_reinit_browser
- File : clients.c Line 955
- Length : 32 Lines
- Declaration:
- short brs_reinit_browser( char *file, char *err_msg1, char *err_msg2)
- --------------------------------------------------------------------------------
- /* This function tells the browser-engine (server1) to re-init with
- a new browser-file
-
- return value:
- 0 ... O.K.
- else ... Error, if RET_ERROR, in err_msg1 and err_msg2 errormessages
- from server
- */
-
-
- ================================================================================
- Function : brs_what_is
- File : clients.c Line 1428
- Length : 82 Lines
- Declaration:
- short brs_what_is( char *item, char *file_in, long line_in,
- char *file, long *line, char *module )
- --------------------------------------------------------------------------------
- /* This function returns definition positions of the unknown item. To handle
- scoping of local items, you can specify the position, where you found that
- item.
- Note: scoping not implemented yet. The line_in is currently ignored
-
- item ... holds the name of the unknown item
- file_in ... file, where item was found (may be "")
- line_in ... line, where item was found (or -1)
- only valid if a filename is specified
-
- file ... file, where item was defined
- line ... the line in the file, where item is defined
- module ... module, the file belongs to (or "")
-
- return:
-
- RET_VAR Return variable-position
-
- RET_FUNCT Return function-position
-
- RET_TYPEDEF Returns typedef
-
- RET_STRUCT Returns struct-identifier
-
- RET_ENUM Returns enum-type-identifier
-
- RET_UNION Returns union-identifier
-
- RET_MACRO Returns macro definition
- Arguments: <macro>,<file>,<line>
-
- 0 ... O.K., function-info is stored in arguments
- RET_END ... No more functions found
- else ... error returned by get_brs_ret
- error-message in macro/file
- */
-
-
-
- ================================================================================
- Function : get_brs_ret
- File : intrface.c Line 1340
- Length : 204 Lines
- Declaration:
- short get_brs_ret(short command, int * server, short *r_flag,
- char *arg1, char *arg2, char *arg3, char *arg4)
- --------------------------------------------------------------------------------
- /* Wait till a return is sent by server. Get return-code
- the flag (if r_flag != NULL) and arguments
- */
-
-
- ================================================================================
- Function : send_brs_cmd
- File : intrface.c Line 1549
- Length : 42 Lines
- Declaration:
- void send_brs_cmd( int server, short ret_code, short flag, char * arg1, char *arg2)
- --------------------------------------------------------------------------------
-
- ================================================================================
- Function : brs_get_item_pos
- File : client.c Line ??? (hand edited)
- Length : ?? Lines
- Declaration:
- short brs_get_item_pos( char *item, char *file_in, long line_in,
- char *file, long *line)
- --------------------------------------------------------------------------------
- /* This function returns the definition position of a given item
- which was found at given position (within an expression). It
- differs from the other brs_get_..._pos functions, because it
- provides a kind of scoping. It returns the position of the
- item which is valid in the context of the given position.
-
- It is also independend from the type of the item so it can be
- used for an identifier of an unknown type.
-
- INPUT:
- item ... item
- file_in ... file, where item was found
- line_in ... line, where item was found
-
- OUTPUT
- (if ret-value is 0:)
- file ... the file, where the item is defined
- line ... linenumber, where item is defined
-
- (if ret-value if RET_ERROR)
- file ... Error message 1
-
- return: 0 ... O.K., variable-info is stored in arguments
- else ... error returned by get_brs_ret
- */
-
- ================================================================================
- Function : brs_cut
- File : brs_extract.lex Line ??? (hand edited)
- Length : ?? Lines
- Declaration:
- short brs_cut(short type, char *s_file, char *t_id, long t_line,
- char **def_line, char ** comment, char**body)
- --------------------------------------------------------------------------------
-
- /* cut's the definition line of a function and a possible leading
- comment.
-
- type ... 0 item is a function, 1 item is something else
-
- source_file ... file where the function is defined
- target_id ... identifier of the function
- target_line ... line, where function is defined (may be set
- between the identifier and the beginning of
- the function-body
- comment ... pointer to a char-pointer; if NULL: do not
- extract comment
- body ... pointer to a char-pointer; if NULL: do not
- extract body
-
-
- Return-values:
- def_line ... pointer to a malloced memory-area with the
- definition line ( '\0'-terminated )
- (or NULL if definition line could not found)
-
- comment ... pointer to the leading comment (malloc used)
- (or NULL if comment could not found)
-
- body ... pointer to the function body (malloc used)
- (or NULL if body could not found)
-
- return-value 0 ... O.K.
- 1 ... item not found
- -1 ... not enough memory
- -2 ... file read or positioning error
- */
-